package com.jxs.android.weiget;

import android.content.Context;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.telecom.weixi.R;

public class BuCustRowView extends LinearLayout {
	private TextView tx1, tx2;
	private boolean split = false;

	public BuCustRowView(Context context, boolean split) {
		this(context, null, false);
	}

	public BuCustRowView(Context context, AttributeSet attrs, boolean split) {
		super(context, attrs);
		setupView(context, split);
	}

	void setupView(Context context, boolean split) {
		this.split = split;
		LayoutInflater flater = LayoutInflater.from(context);
		if (this.split)
			flater.inflate(R.layout.cust_row_split, this);
		else
			flater.inflate(R.layout.cust_row, this);
		tx1 = (TextView) findViewById(R.id.cust_title);
		tx2 = (TextView) findViewById(R.id.cust_content);
	}

	public View initContent(String content1, String content2) {
		if (this.split)
			tx1.setText(content1);
		else
			tx1.setText(content1 + "：");
		tx2.setText(content2);
		return this;
	}

	public View initContent(String content1, String content2, boolean flag) {
		if (flag) {
			tx2.setSingleLine(false);
			tx2.setPadding(10, 0, 0, 0);
			tx2.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
			tx1.setVisibility(View.GONE);
		}
		return initContent(content1, content2);
	}

}